package com.truckdispatching.util;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map.Entry;

public class TruckLengthUtil {
	private static HashMap<String, String> TruckLengthMap = new HashMap<String, String>();
	static {
		TruckLengthMap.put("4米", "TKLEN_40");
		TruckLengthMap.put("4.2米", "TKLEN_42");
		TruckLengthMap.put("4.3米", "TKLEN_43");
		TruckLengthMap.put("4.5米", "TKLEN_45");
		TruckLengthMap.put("4.8米", "TKLEN_48");
		TruckLengthMap.put("5米", "TKLEN_50");
		TruckLengthMap.put("5.8米", "TKLEN_58");
		TruckLengthMap.put("6米", "TKLEN_60");
		TruckLengthMap.put("6.2米", "TKLEN_62");
		TruckLengthMap.put("6.8米", "TKLEN_68");
		TruckLengthMap.put("7米", "TKLEN_70");
		TruckLengthMap.put("7.2米", "TKLEN_72");
		TruckLengthMap.put("7.4米", "TKLEN_74");
		TruckLengthMap.put("7.8米", "TKLEN_78");
		TruckLengthMap.put("8米", "TKLEN_80");
		TruckLengthMap.put("8.7米", "TKLEN_87");
		TruckLengthMap.put("8.8米", "TKLEN_88");
		TruckLengthMap.put("9米", "TKLEN_90");
		TruckLengthMap.put("9.6米", "TKLEN_96");
		TruckLengthMap.put("12.5米", "TKLEN_125");
		TruckLengthMap.put("13米", "TKLEN_130");
		TruckLengthMap.put("13.5米", "TKLEN_135");
		TruckLengthMap.put("16米", "TKLEN_160");
		TruckLengthMap.put("17.5米", "TKLEN_175");
	}

	public synchronized static String getTruckLengthCode(String lengthName) {
		return TruckLengthMap.get(lengthName);
	}

	public synchronized static String getTruckLengthName(String lengthCode) {
		for (Entry<String, String> entry : TruckLengthMap.entrySet()) {
			if (entry.getValue().equals(lengthCode)) {
				return entry.getKey();
			}
		}
		return "";
	}

	public synchronized static ArrayList<String> getTruckLengthArrayList() {
		ArrayList<String> lengthList = new ArrayList<String>();
		lengthList.add("4米");
		lengthList.add("4.2米");
		lengthList.add("4.3米");
		lengthList.add("4.5米");
		lengthList.add("4.8米");
		lengthList.add("5米");
		lengthList.add("5.8米");
		lengthList.add("6米");
		lengthList.add("6.2米");
		lengthList.add("6.8米");
		lengthList.add("7米");
		lengthList.add("7.2米");
		lengthList.add("7.4米");
		lengthList.add("7.8米");
		lengthList.add("8米");
		lengthList.add("8.7米");
		lengthList.add("8.8米");
		lengthList.add("9米");
		lengthList.add("9.6米");
		lengthList.add("12.5米");
		lengthList.add("13米");
		lengthList.add("13.5米");
		lengthList.add("16米");
		lengthList.add("17.5米");
		return lengthList;
	}
}
